Object.classPrototype.toJson

Instance of

Function

Return value

/*String*/

Description

The toJson method converts an object to a JSON string.

Example

console.write({ arr: [1, "a", true]});

Expected output

{
    "arr": [1, "a", true]
}

This page has text and code adapted from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify
Prose content on this page is available under (CC-BY-SA 2.5).
Code examples on this page and snippets are in the public domain (CC0).